import java.util.Arrays;
public class insertl {
    public static void main(String[] args) {
        int[] a = {53, 27, 36, 15, 69, 42};
        System.out.println("初始状态：" + Arrays.toString(a));
        int[] b = InserSort(a);
        System.out.println("最终状态：" + Arrays.toString(b));
    }
    public static int[] InserSort(int[] a) {
        int i, j, num = 0;
        for (i = 1; i < a.length; i++) {
            int b = a[i];
            for (j = i - 1; j >= 0; j--) {
                if (a[j] > b) {
                    a[j + 1] = a[j];
                } else {
                    break;
                }
            }
            a[j + 1] = b;
            System.out.println("第" + (++num) + "趟排序：" + Arrays.toString(a));
        }
            return a;
        }
    }
